#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>

int res = 0;

void* thread_main(void *arg) {
    for (int i = 1; i <= (*(int *)arg); i++)    
        res += i;
    return (void *)&res;
}

int main() {
    pthread_t pid;
    int para = 100;
    pthread_create(&pid, NULL, thread_main, (void *)&para);
    void *rv; 
    pthread_join(pid, &rv);
    printf("return value %d", *(int *)rv);
    return 0;
}